package com.power.controller;

import com.power.domain.Category;
import com.power.model.Result;
import com.power.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/prod")
public class productController {
    @Autowired
    private CategoryService categoryService;
//    @GetMapping("/prod/page")
//    public Result getProductPageList(@RequestBody Integer current,@RequestBody Integer size,
//                                     @RequestBody(required = false) String categoryname,@RequestBody(required = false)
//                                     Integer status) {
//        Page<Category> page=new Page<>(current,size);
//       Page pagelist= categoryService.pageList(page,categoryname,status);
//        return Result.success(pagelist);
//    }
    @GetMapping("/category/table")
//    @PreAuthorize("hasAuthority('product:catory:page')")
    public Result getCategoryTable() {
        List<Category> list=categoryService.getCategorytable();
        return Result.success(list);
    }
    @GetMapping("/category/listCategory")
    public Result getCategoryList() {
        List<Category> list = categoryService.listCategory();
        return Result.success(list);
    }
}
